﻿using ProjectFootball.MVC.Foundation;
using ProjectFootball.MVC.Foundation.ResourceLibrary;
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Security.Principal;

namespace ProjectFootball.MVC.Models.EntityFramework.Entities
{
    public class MatchEvent : BaseApprovableEntity, IApprovableEntity
    {
        #region Constructors
        public MatchEvent()
        {
        }

        public MatchEvent(IPrincipal user, CreateType createType, Guid approvalGuid, Guid matchGuid, Guid teamGuid, Guid personGuid, MatchEventType matchEventType, short minute, short? extra)
            :base(user, createType, approvalGuid)
        {
            MatchGuid = matchGuid;
            TeamGuid = teamGuid;
            PersonGuid = personGuid;
            MatchEventType = matchEventType;
            Minute = minute;
            Extra = extra;
        }
        #endregion

        [ForeignKey("Match")]
        public Guid MatchGuid { get; set; }

        [ForeignKey("Team")]
        public Guid TeamGuid { get; set; }

        [ForeignKey("Person")]
        public Guid PersonGuid { get; set; }

        public MatchEventType MatchEventType { get; set; }

        public short Minute { get; set; }

        public short? Extra { get; set; }

        [ForeignKey("MatchGuid")]
        public virtual Match Match { get; set; }

        [ForeignKey("TeamGuid")]
        public virtual Team Team { get; set; }

        [ForeignKey("PersonGuid")]
        public virtual Person Person { get; set; }
    }
}